/**
 * Element 组件库
 */

import {
  Button,
  Col,
  Empty,
  Form,
  FormItem,
  Input,
  InputNumber,
  Row,
  TabPane,
  Tabs,
  Scrollbar,
  Dialog,
  Switch,
  Select,
  Option,
  Collapse,
  CollapseItem,
  RadioGroup,
  RadioButton,
  Popover,
  Tooltip,
  Table,
  TableColumn,
  Loading,
  Card,
  Image,
  DatePicker,
  Pagination,
  Header,
  MessageBox
} from 'element-ui'

const components = [
  Row,
  Col,
  Button,
  Form,
  FormItem,
  Input,
  InputNumber,
  Tabs,
  TabPane,
  Empty,
  Dialog,
  Switch,
  Select,
  Option,
  Collapse,
  CollapseItem,
  Scrollbar,
  RadioGroup,
  RadioButton,
  Popover,
  Tooltip,
  Table,
  TableColumn,
  Card,
  Image,
  DatePicker,
  Pagination,
  Header
]

const install = Vue => {
  components.forEach(component => {
    Vue.component(component.name, component)
  })
  Vue.prototype.$ELEMENT = { size: 'small' }
  Vue.prototype.$alert = MessageBox.alert

  Vue.use(Loading.directive)
  Vue.prototype.$loading = Loading.service
}

export default install
